rustup --version
if [[ $? -eq 1 ]]
then
  curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
fi
DIR=$( dirname "$(readlink -f  ${BASH_SOURCE[0]})" )
#当前脚本上一层路径
PARENTPATH=$(dirname ${DIR})
if [[ ! -d ${HOME}/temp/github ]]
then
  mkdir -p ${HOME}/temp/github
fi
sh ${PARENTPATH}/tools/gitclone.sh https://github.com/alacritty/alacritty.git ${HOME}/temp/github/alacritty
cd ${HOME}/temp/github/alacritty
echo "enter github folder.."
rustup override set stable
rustup update stable
echo y | sudo apt install cmake pkg-config libfreetype6-dev libfontconfig1-dev libxcb-xfixes0-dev python3
cargo build --release
sudo cp target/release/alacritty /usr/local/bin # or anywhere else in $PATH
sudo cp extra/logo/alacritty-term.svg /usr/share/pixmaps/Alacritty.svg
sudo desktop-file-install extra/linux/Alacritty.desktop
sudo update-desktop-database
# zsh
mkdir -p ${ZDOTDIR:-~}/.zsh_functions
echo 'fpath+=${ZDOTDIR:-~}/.zsh_functions' >> ${ZDOTDIR:-~}/.zshrc
cp extra/completions/_alacritty ${ZDOTDIR:-~}/.zsh_functions/_alacritty
# bash
mkdir -p ${HOME}/.bash_completion
cp extra/completions/alacritty.bash ${HOME}/.bash_completion/alacritty
echo "source ~/.bash_completion/alacritty" >> ${HOME}/.bashrc

